<div class="main">
	<div class="container">
		<div style="background:#fff;min-height: 800px; margin: 20px 0; padding: 20px;">
			<div class="product_detail">
				<div class="product_hd">
					<div style="width: 400px; height: 300px;background-position:center;background-repeat:no-repeat;background-size:auto 100%;background-image:url({$rs.image});" ></div>
					<div class="content">
						<div class="title">{$rs.name}</div>
						<div class="desc">价格：<span style="color:#FF1212;font-size:20px;font-weight:700;"> ￥{$rs.price}</span></div>
						<div class="desc">分享到：<strong id="jjy-share">
								<img src="/pc/img/weixin.jpg" data-jjyshare="weixin" />&nbsp;
								<img src="/pc/img/weibo.jpg" data-jjyshare="weibo" />&nbsp;
								<img src="/pc/img/qq-qzone.png" data-jjyshare="qq_qzone" />&nbsp;
								<img src="/pc/img/qq.jpg" data-jjyshare="qq" />&nbsp;
								<img src="/pc/img/link.jpg" data-jjyshare="copylink" />&nbsp;
							</strong></div>
						<div class="desc"><button class="layui-btn layui-btn-lg layui-btn-normal layui-btn-radius" lay-on="test-offset-b"><i
						class="iconfont">&#xe63c;</i> 联系客服</button>
						</div>
					</div>
				</div>
				<div class="product_bd">
					<div class="sec_title">
						<h3>书籍介绍</h3>
					</div>
					<div class="content">
						{$rs.content}
					</div>
					<div class="sec_title">
						<h3>订购方式</h3>
					</div>
					<div class="content" style="display:flex;align-items:flex-start;">
					    <ul class="infos" style="display:inline-block;">
					        <li style="font-weight:bold;">银行卡信息</li>
							<li><span class="label">收款单位：</span>{$site.bank_danwei}</li>
							<li><span class="label">开户银行：</span>{$site.bank_bankname}</li>
							<li><span class="label">开户支行：</span>{$site.bank_zhihang}</li>
							<li><span class="label">银行卡号：</span>{$site.bank_bankcard}</li>
						</ul>
						
						<ul class="infos" style="display:inline-block; margin-left:100px;">
						    <li style="font-weight:bold;">支付宝信息</li>
							<li><span class="label">收款单位：</span>{$site.alipay_danwei}</li>
							<li><span class="label">支付宝账号：</span>{$site.alipay_account}</li>
							<li><span class="label">支付宝二维码：</span><img src="{$site.alipay_qrcode}" style="width:150px;height:auto;" /></li>
						</ul>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script src="/pc/js/jjy-share-v2.0.js"></script>
<script>
	jjyShare({
		weiboUserId: 0, //微博平台账号ID
		sourceName: '{$site.name}', //来源站点名称
		title: document.title, //分享的标题
		des: "{$rs.name|strip_tags|msubstr=0,80,'utf-8',true}", //页面描述,控制在120个字以下
		imgagesUrl: '{$rs.image}', //分享携带的图片
	});
	
	var layer = layui.layer;
		layui.use(function(){
		  layer = layui.layer;
		  var util = layui.util;
		  var form = layui.form;
		  var $ = layui.$;
		  // 事件
		  util.on('lay-on', {
		    'test-offset-b': function(){
		      layer.open({
		        type: 1,
				title: '联系客服',
		        offset: 'auto',
		        anim: 'slideUp', // 从下往上
		        area: ['320px', '320px'],
		        shade: 0.1,
		        shadeClose: true,
		        id: 'ID-demo-layer-direction-b',
		        content: '<div style="padding: 16px;">'+
					'<div style="display:flex;justify-content:center; margin-bottom:15px;">'+
						'<img src="{$site.dingyuekefu1}" style="width:150px;height:150px;">'+
						'<img src="{$site.dingyuekefu2}" style="width:150px;height:150px;">'+
					'</div>'+
					'<a href="tel:{$site.kefutel}"><div style="text-align:center">联系电话:{$site.kefutel}</div></a>'+
					'<div style="display:flex;justify-content:center; margin-top:15px;">'+
						'<button class="layui-btn layui-btn-normal layui-border-normal layui-btn-radius" onclick="save_pic()">保存图片到相册</button>'+
						'<button class="layui-btn layui-btn-normal layui-border-normal layui-btn-radius" onclick="copy({$site.kefutel})">一键复制联系电话</button>'+
					'</div>'+
				'</div>'
		      });
		    },
		    
		  });
		  
		  form.on('select(demo-select-filter)', function(data){
		      var elem = data.elem; // 获得 select 原始 DOM 对象
		      var value = data.value; // 获得被选中的值
		      var othis = data.othis; // 获得 select 元素被替换后的 jQuery 对象
		      window.location.href="{:url('zhuanyeshukan/qikan_detail')}?id={$rs.id}&year="+value;
		      layer.msg(this.innerHTML + ' 的 value: '+ value); // this 为当前选中 <option> 元素对象
		    });
		});
		
		function copy(text) {

		  const input = document.createElement('textarea');
		  input.value = text;
		  document.body.appendChild(input);
		  input.select();
		  document.execCommand('copy');
		  document.body.removeChild(input);
		  layer.msg('复制成功');
		}
		function save_pic(){
			// 获取图片URL
			var imgUrl = '{$site.dingyuekefu1}';
			 
			// 创建一个临时的链接元素
			var link = document.createElement('a');
			link.href = imgUrl;
			 
			// 设置链接元素的下载属性为图片的名称
			link.download = get_file_name('{$site.dingyuekefu1}');
			 
			// 将链接元素点击事件派发到文档
			document.body.appendChild(link);
			link.click();
			document.body.removeChild(link);
			
			// 获取图片URL
			var imgUrl = '{$site.dingyuekefu2}';
			 
			// 创建一个临时的链接元素
			var link = document.createElement('a');
			link.href = imgUrl;
			 
			// 设置链接元素的下载属性为图片的名称
			link.download = get_file_name('{$site.dingyuekefu2}');
			 
			// 将链接元素点击事件派发到文档
			document.body.appendChild(link);
			link.click();
			document.body.removeChild(link);
		}
		function get_file_name(url){

			
			// 创建 URLSearchParams 对象并传入 URL
			fileName=url.split('/');
			return fileName[fileName.length-1];
		}
		console.log(get_file_name('{$site.dingyuekefu1}'));
</script>